In [1]:
library(gdata)
In [2]:
GBD <- read.table("../Data/DALY_YLL_deaths_per_region_and_27_diseases_2005.txt")
RCT_regs <- read.table("../Data/RCTs_and_Patients_Nb_local_prop_median_UI_per_region_and_disease.txt")
RCT_dis <- read.table("../Data/RCTs_and_Patients_prop_among_all_and_HI_median_UI_across_regions_per_disease.txt")
In [3]:
head(GBD)
In [4]:
head(RCT_regs)
In [5]:
head(RCT_dis)
In [6]:
levels(GBD$Region)
levels(RCT_regs$Region)
levels(RCT_dis$Region)
In [7]:
levels(GBD$Disease)
levels(RCT_regs$Disease)
levels(RCT_dis$Disease)
In [8]:
#Adding to GBD data , burden of all diseases in all regions
gbd_all <- tapply(GBD$burden[GBD$Region=="All"],paste(GBD$metr[GBD$Region=="All"],GBD$Region[GBD$Region=="All"]),sum)
gbd_all <- data.frame(metr=levels(GBD$metr),
Region="All",
Disease="all",
burden=as.numeric(gbd_all))
GBD <- rbind(GBD,gbd_all)
levels(GBD$Disease)[1] <- "All"
In [9]:
GBD <- GBD[order(GBD$Region,GBD$Disease),]
In [10]:
#Adding burden in Non-High-income regions
gbd_nhi <- GBD[GBD$Region=="All",]
gbd_nhi$Region <- "Non-HI"
gbd_nhi$burden <- gbd_nhi$burden - GBD$burden[GBD$Region=="High-income"]
GBD <- rbind(GBD,gbd_nhi)
In [11]:
GBD$Region <- reorder(GBD$Region,new.order=sort(levels(GBD$Region)))
In [12]:
#Different columns for each metric of burden
GBDdaly <- GBD[GBD$metr=="daly",]
GBDdaly$burden_daly <- GBDdaly$burden
GBDyll <- GBD[GBD$metr=="yll",]
GBDyll$burden_yll <- GBDyll$burden
GBDyld <- GBD[GBD$metr=="yld",]
GBDyld$burden_yld <- GBDyld$burden
GBDdeath <- GBD[GBD$metr=="death",]
GBDdeath$burden_death <- GBDdeath$burden
In [13]:
G <- merge(GBDdaly,GBDyll,by=c("Region","Disease"),all=TRUE)
G <- merge(G,GBDyld,by=c("Region","Disease"),all=TRUE)
G <- merge(G,GBDdeath,by=c("Region","Disease"),all=TRUE)
In [14]:
G <- G[,c("Region", "Disease", "burden_daly", "burden_yll", "burden_yld", "burden_death")]
In [15]:
head(G)
In [16]:
#Within regions, local proportions of burden across diseases
G$Prop_loc_burden_daly <- 100*G$burden_daly/rep(G$burden_daly[G$Disease=="All"],as.numeric(table(G$Region)))
G$Prop_loc_burden_yll <- 100*G$burden_yll/rep(G$burden_yll[G$Disease=="All"],as.numeric(table(G$Region)))
G$Prop_loc_burden_yld <- 100*G$burden_yld/rep(G$burden_yld[G$Disease=="All"],as.numeric(table(G$Region)))
G$Prop_loc_burden_death <- 100*G$burden_death/rep(G$burden_death[G$Disease=="All"],as.numeric(table(G$Region)))
In [17]:
#Within diseases, global proportion of burden across regions
G$Prop_glob_burden_daly <- 100*G$burden_daly/rep(G$burden_daly[G$Region=="All"],times=length(levels(G$Region)))
G$Prop_glob_burden_yll <- 100*G$burden_yll/rep(G$burden_yll[G$Region=="All"],times=length(levels(G$Region)))
G$Prop_glob_burden_yld <- 100*G$burden_yld/rep(G$burden_yld[G$Region=="All"],times=length(levels(G$Region)))
G$Prop_glob_burden_death <- 100*G$burden_death/rep(G$burden_death[G$Region=="All"],times=length(levels(G$Region)))
In [18]:
#Within diseases, proportion of burden across non-high-income regions
G$Prop_NHI_burden_daly <- 100*G$burden_daly/rep(G$burden_daly[G$Region=="Non-HI"],times=length(levels(G$Region)))
G$Prop_NHI_burden_yll <- 100*G$burden_yll/rep(G$burden_yll[G$Region=="Non-HI"],times=length(levels(G$Region)))
G$Prop_NHI_burden_yld <- 100*G$burden_yld/rep(G$burden_yld[G$Region=="Non-HI"],times=length(levels(G$Region)))
G$Prop_NHI_burden_death <- 100*G$burden_death/rep(G$burden_death[G$Region=="Non-HI"],times=length(levels(G$Region)))
G$Prop_NHI_burden_daly[G$Region%in%c("All","High-income")] <- NA
G$Prop_NHI_burden_yll[G$Region%in%c("All","High-income")] <- NA
G$Prop_NHI_burden_yld[G$Region%in%c("All","High-income")] <- NA
G$Prop_NHI_burden_death[G$Region%in%c("All","High-income")] <- NA
In [19]:
names(RCT_regs)
names(RCT_dis)
names(G)
In [20]:
names(RCT_regs) <- gsub("Prop","Prop_loc",names(RCT_regs))
names(RCT_dis) <- gsub("_all_","_glob_",names(RCT_dis))
In [21]:
DT <- merge(G,RCT_regs,by=c("Region","Disease"),all=TRUE)
DT <- merge(DT,RCT_dis,by=c("Region","Disease"),all=TRUE)
In [22]:
head(DT)
In [23]:
write.table(DT,"../Data/All_data.txt")
In [ ]: